#include <bits/stdc++.h>
// 2025/02/03
// tag:
// Author: Zhang Muen
using namespace std;

int n, m, a[101], dp[101][101];

signed main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= m; j++)
            for (int k = 0; k <= min(j, a[i]); k++)
                dp[i][j] += dp[i - 1][j - k], dp[i][j] %= 1000007;
    cout << dp[n][m];
    return 0;
}